<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        .box {
            width: 450px;
            height: 600px;
            border: 1px solid #333;
            display: flex;
            flex-direction: column;
            margin: 50px;
            position: relative;
        }

        .box>.show {
            width: 450px;
            height: 450px;
            border-bottom: 1px solid #333;
            position: relative;
        }

        .box>.show>.mask {
            width: 200px;
            height: 200px;
            background-color: yellow;
            opacity: 0.5;
            position: absolute;
            left: 30px;
            top: 40px;
            pointer-events: none;
            display: none;
        }

        .box>.show>img {
            width: 100%;
            height: 100%;
            display: block;
        }

        .box>.list {
            flex: 1;
            box-sizing: border-box;
            padding: 20px;
            display: flex;
            align-items: center;
        }

        .box>.list>img {
            width: 54px;
            height: 54px;
            border: 1px solid #333;
            margin-right: 15px;
            cursor: pointer;
        }

        .box>.list>img.active {
            border-color: orange;
        }

        .box>.enlarge {
            width: 400px;
            height: 400px;
            position: absolute;
            left: 110%;
            top: 0;
            border: 1px solid red;
            overflow: hidden;

            /* display: none; */
        }

        .box>.enlarge>img {
            display: block;
            width: 800px;
            height: 800px;
            position: absolute;
            left: 0;
            top: 0;
        }
    </style>
</head>

<body>

    <!-- 布局结构 -->
    <!-- 整个放大镜区域 -->
    <div class="box" id="box">

        <!-- 正常显示图片区域 -->
        <div class="show">
            <img src="./imgs/1.jpg" alt="">

            <!-- 遮罩层盒子 -->
            <div class="mask"></div>
        </div>

        <!-- 图片切换列表 -->
        <div class="list">
            <img class="active" src="./imgs/1.small.jpg" data-show="./imgs/1.jpg" data-bg="./imgs/1.big.jpg" alt="">

            <img src="./imgs/2.small.jpg" data-show="./imgs/2.jpg" data-bg="./imgs/2.big.jpg" alt="">
        </div>

        <!-- 放大镜的盒子 -->
        <div class="enlarge">
            <img src="./imgs/1.big.jpg" alt="">
        </div>
    </div>
    <script src="./enlarge.js"></script>
    <script>
        const e = new Enlarge('#box')
    </script>
</body>

</html>